home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCSmallEiffel / lib_se / e_debug.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  3.2 KB  |  146 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class E_DEBUG
  17.    --
  18.    -- The instruction "debug ... end".
  19.    --
  20.  
  21. inherit INSTRUCTION;
  22.    
  23. creation make
  24.    
  25. feature 
  26.    
  27.    start_position: POSITION;
  28.    
  29.    list: ARRAY[MANIFEST_STRING];
  30.    
  31.    compound: COMPOUND;
  32.  
  33. feature
  34.  
  35.    make(sp: like start_position; l: like list; c: like compound) is
  36.       require
  37.      sp /= Void
  38.       do
  39.      start_position := sp;
  40.      list := l;
  41.      compound := c;
  42.       ensure      
  43.      start_position = sp;
  44.      list = l;
  45.      compound = c;
  46.       end;
  47.    
  48. feature
  49.  
  50.    is_pre_computable: BOOLEAN is false;
  51.  
  52.    end_mark_comment: BOOLEAN is true;
  53.    
  54. feature
  55.  
  56.    to_runnable(rc: like run_compound): like Current is
  57.       do
  58.      if run_compound = Void then
  59.         run_compound := rc;
  60.         if run_control.debug_check then
  61.            if compound /= Void then
  62.           compound := compound.to_runnable(current_type);
  63.            end;
  64.         end;
  65.         Result := Current;
  66.      else
  67.         !!Result.make(start_position,list,compound);
  68.         Result := Result.to_runnable(rc);
  69.      end;
  70.       end;
  71.    
  72.    afd_check is   
  73.       do
  74.      if run_control.debug_check then
  75.         if compound /= Void then
  76.            compound.afd_check;
  77.         end;
  78.      end;
  79.       end;
  80.  
  81.    compile_to_c is   
  82.       do
  83.      if run_control.debug_check then
  84.         if compound /= Void then
  85.            compound.compile_to_c;
  86.         end;
  87.      end;
  88.       end;
  89.  
  90.    compile_to_jvm is
  91.       do
  92.      if run_control.debug_check then
  93.         if compound /= Void then
  94.            compound.compile_to_jvm;
  95.         end;
  96.      end;
  97.       end;
  98.    
  99.    use_current: BOOLEAN is   
  100.       do
  101.      if run_control.debug_check then
  102.         if compound /= Void then
  103.            Result := compound.use_current; 
  104.         end;
  105.      end;
  106.       end;
  107.    
  108.    pretty_print is
  109.       local
  110.      i: INTEGER;
  111.       do
  112.      fmt.keyword("debug");
  113.      fmt.level_incr;
  114.      if list /= Void then
  115.         fmt.put_character('(');
  116.         from  
  117.            i := list.lower;
  118.         until
  119.            i > list.upper
  120.         loop
  121.            list.item(i).pretty_print;
  122.            i := i + 1;
  123.            if i <= list.upper then
  124.           fmt.put_character(',')
  125.            end;
  126.         end;
  127.         fmt.put_character(')');
  128.      end;
  129.      fmt.level_decr;
  130.      if compound /= Void then
  131.         compound.pretty_print;
  132.      end;
  133.      fmt.indent;
  134.      fmt.keyword("end;");
  135.      if fmt.print_end_debug then
  136.         fmt.put_end("debug");
  137.      end;
  138.       end;
  139.  
  140. invariant
  141.    
  142.    start_position /= Void
  143.    
  144. end -- E_DEBUG
  145.  
  146.